<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1 id="txt">开始抽奖吧</h1>
    <button id="start">开始</button>
    <button id="end">结束</button>
    <script>
   var txt=document.getElementById('txt')
   var start=document.getElementById('start')
   var end=document.getElementById('end')
   var user=['老一','老二','老三','老四','老五','老六','老七','老八','老九','老十'];
   var timer;
   start.onclick=function(){
       clearInterval(timer)
      timer=setInterval(function(){
           var n=parseInt(Math.random()*user.length);
           txt.innerHTML=user[n];
       },100)
   }
   end.onclick=function(){
       clearInterval(timer)
   }
 </script>
 </body>
</html>